import { h } from 'vue';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '订单号',
    key: 'out_order_no',
    align: "center",
  }, {
    title: '用户会员号',
    key: 'member_card',
    align: "center",
  }, {
    title: '属性',
    key: 'attr',
    align: "center",
    render(row) {
      if (row.attr == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('充电宝'),
          },
        );
      } else if (row.attr == 2) {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('充电盒子'),
          },
        );
      } else if (row.attr == 3) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('充电线'),
          },
        );
      }
    }
  }, {
    title: '设备号',
    key: 'charge_number',
    align: "center",
  }, {
    title: '金额',
    key: 'money',
    align: "center",
  }, {
    title: '平台',
    key: 'pingtai',
    align: "center",
    render(row) {
      if (row.pingtai == 0) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('微信小程序'),
          },
        );
      } else if (row.pingtai == 1) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('支付宝小程序'),
          },
        );
      } else if (row.pingtai == 2) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('抖音小程序'),
          },
        );
      }
    }
  }, {
    title: '门店名称',
    key: 'wdtitle',
    align: "center",
  }, {
    title: '时间',
    key: 'sdate',
    align: "center",
  }, {
    title: '订单类型',
    key: 'member_id',
    align: 'center',
    render(row) {
      if (row.member_id == 0) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('普通订单'),
          },
        );
      } else {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('会员订单'),
          },
        );
      }
    }
  }, {
    title: '状态',
    key: 'status',
    align: "center",
    render(row) {
      if (row.status == 0) {
        return h(
          NTag,
          {
            type: 'default',
          },
          {
            default: () => ('弹宝中'),
          },
        );
      } else if (row.status == 1) {
        return h(
          NTag,
          {
            type: 'primary',
          },
          {
            default: () => ('计费中'),
          },
        );
      } else if (row.status == 2) {
        return h(
          NTag,
          {
            type: 'primary',
          },
          {
            default: () => ('暂停计费'),
          },
        );
      } else if (row.status == 3) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('待支付'),
          },
        );
      } else if (row.status == 4) {
        return h(
          NTag,
          {
            type: 'default',
          },
          {
            default: () => ('支付中'),
          },
        );
      } else if (row.status == 5) {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('已完成'),
          },
        );
      } else if (row.status == 6) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('已取消'),
          },
        );
      } else if (row.status == 7) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('部分退款'),
          },
        );
      } else if (row.status == 8) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('全部退款'),
          },
        );
      } else if (row.status == 9) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('退款中'),
          },
        );
      } else if (row.status == 11) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('已购买'),
          },
        );
      } else if (row.status == 12) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('购宝待付款'),
          },
        );
      }
    }
  }
];
